using System;
using System.Collections.Generic;
using System.Drawing;
using Microsoft.DirectX.Direct3D;
using Microsoft.DirectX;

namespace TTDotNet.Engine.ThreeDEngine
{
    struct AJVertex
    {
        public Vector3 pos;
        public Vector2 TexCoord;

        public AJVertex(Vector3 pos, float texx, float texy)
        {
            this.pos = pos;
            TexCoord.X = texx;
            TexCoord.Y = texy;
        }
    }

    //public class ShadedGeometry : AJObject
    //{
    //    private VertexBuffer vertexBuffer;
    //    //private IndexBuffer indexBuffer;
    //    private VertexDeclaration vd;
    //    private Effect effect;
    //    private Texture myTexture;
    //    //private int[] indices;

    //    public ShadedGeometry()
    //    {
    //        effect = Effect.FromFile(Game.device, "../../../data/Shader.fx", null, null, ShaderFlags.None, null);
    //        myTexture = Game.textureCacher.LoadTexture("artwork/512/Road.jpg").Texture;
    //        BuildVertexBuffer();
    //    }

    //    private void BuildVertexBuffer()
    //    {
    //        AJVertex[] vertices = new AJVertex[6];

    //        vertices[0] = new AJVertex(new Vector3(0, 2, 0), 0.0f, 1.0f);
    //        vertices[1] = new AJVertex(new Vector3(1, 2, 1), 1.0f, 0.0f);
    //        vertices[2] = new AJVertex(new Vector3(1, 2, 0), 1f, 1.0f);

    //        vertices[3] = new AJVertex(new Vector3(0, 2, 0), 0.0f, 1.0f);
    //        vertices[4] = new AJVertex(new Vector3(0, 2, 1), 0.0f, 0.0f);
    //        vertices[5] = new AJVertex(new Vector3(1, 2, 1), 1f, 0.0f);

    //        vertexBuffer = new VertexBuffer(typeof(AJVertex), 6, Game.device, Usage.None,
    //                                        VertexFormats.Position | VertexFormats.Normal | VertexFormats.Texture0, Pool.Default);

    //        vertexBuffer.SetData(vertices, 0, LockFlags.None);

    //        VertexElement[] velements = new VertexElement[]
    //         {
    //              new VertexElement(0, 0, DeclarationType.Float3, DeclarationMethod.Default, DeclarationUsage.Position, 0),
    //              new VertexElement(0, 12, DeclarationType.Float2, DeclarationMethod.Default, DeclarationUsage.TextureCoordinate, 0),
    //              VertexElement.VertexDeclarationEnd
    //         };
    //        vd = new VertexDeclaration(Game.device, velements);
    //    }

    //    public override void Render(AJCamera camera)
    //    {
    //        Game.device.RenderState.Lighting = false;
    //        Game.device.RenderState.CullMode = Cull.CounterClockwise;
    //        Game.device.Transform.World = Matrix.Identity;
    //        Game.device.SetTexture(0, null);
    //        Game.device.SetStreamSource(0, vertexBuffer, 0);
    //        Game.device.VertexDeclaration = vd;

    //        effect.Technique = "Simplest";
    //        effect.SetValue("xViewProjection", Matrix.Multiply(Game.myCamera.View, Game.myCamera.Projection));
    //        effect.SetValue("xColoredTexture", myTexture);

    //        int numpasses = effect.Begin(0);
    //        for (int i = 0; i < numpasses; i++)
    //        {
    //            effect.BeginPass(i);
    //            Game.device.DrawPrimitives(PrimitiveType.TriangleList, 0, 2);
    //            effect.EndPass();
    //        }
    //        effect.End();
    //    }
    //}
}
